package com.byl.modules.sys.service.impl;

import com.byl.modules.sys.dao.DictDao;
import com.byl.modules.sys.service.DictService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by Administrator on 2018/11/15/015.
 */
@SuppressWarnings("SpringJavaAutowiringInspection")
@Service
public class DictServiceImpl implements DictService {

    @Autowired
    DictDao dictDao;


    @Override
    public List<Map> listDictChild(String parentID) {
        return dictDao.listDictChild(parentID);
    }

    @Override
    public int checkCode(String code) {
        return dictDao.checkCode(code);
    }

    @Override
    public int saveDict(Map map) {
        return dictDao.saveDict(map);
    }

    @Override
    public int deleteDict(String id) {
        return dictDao.deleteDict(id);
    }

    @Override
    public int editStatus(Map map) {
        return dictDao.editStatus(map);
    }

    @Override
    public int updateDict(Map map) {
        return dictDao.updateDict(map);
    }

    @Override
    public Map<String,List<Map>> queryDictByParentType(String types) {
        Map<String,List<Map>> map=new HashMap<>();
        String []gdt=types.split(",");
        for(String type: gdt){
         map.put(type,dictDao.queryDictByParentType(type));
        }
        return map;
    }

    @Override
    public List<Map> queryChildDict(String type) {
        return dictDao.queryChildDict(type);
    }


    @Override
    public List<Map> queryDictType() {
        return dictDao.queryDictType();
    }
}
